#include <iostream>
#include <vector>

using namespace std;

template <typename T>
void BinarySearch(vector<T>& v,T num){
    int low=0;
    int high=v.size()-1;
    while(low<=high){
        int mid=low+(high-low)/2;
        if(v[mid]<num){
            low=mid+1;
        }else if(v[mid]>num){
            high=mid-1;
        }else{
            cout<<"find v[mid]="<<v[mid]<<";num="<<num<<endl;
            break;
        }
    }
}

int main(){
    vector<int> v={1,2,3,4,5};
    vector<double> vd={1.2,3.4,5.4};
    // BinarySearch(v,3);
    BinarySearch(vd,1.2);
    return 0;
}